/// MicroIRCd

#include "deps.h"
#include "server.h"
#include "functions.h"

void _log(char *fmt, ...)
{
    int i;
    char buf[BUF_SIZE];
    char timestr[32];
    time_t t = time(0);
    va_list ap;
    va_start(ap, fmt);
    vsnprintf(buf, BUF_SIZE - 1, fmt, ap);
    va_end(ap);
    for (i = 0; i < (int)strlen(buf) - 1; i++)
        buf[i] = (unsigned char)buf[i] < 32 ? '.' : buf[i];
    strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S ", localtime(&t));
    fprintf(stdout, "%s", timestr);
    fprintf(stdout, "%s", buf);
    fflush(stdout);
}
